import {
  Dimensions,
  StyleSheet,
  Text,
  View,
  Image,
  ScrollView,
} from "react-native";
import React, { useEffect, useState } from "react";
import { useRoute } from "@react-navigation/native";
import axios from "axios";
import Api from '../Api/api'
export default function DescAcademic() {
  let route = useRoute();
  let [List, setlist] = useState([]);
  const { id } = route.params; //接受路由id
  useEffect(() => {
    getexpoer();
  }, []);
  const getexpoer = async () => {
    let {
      data: { data },
    } = await Api.get("/yg/getexpert", {
      params: { id },
    });
    setlist(data);
  };
  return (
    <View style={styles.container}>
      {List.map((item) => (
        <View key={item._id}>
          <View style={styles.top}>
            <Image
              source={{ uri: item.img }}
              style={{ width: 100, height: 100 }}
            />
            <View style={{ justifyContent: "center", alignItems: "center" }}>
              <Text style={{ paddingLeft: 10 }}>科 室: {item.department}</Text>
              <Text style={{ marginTop: 10, paddingLeft: 10 }}>
                职 称: {item.job}
              </Text>
            </View>
          </View>
          <ScrollView>
            <View style={styles.main}>
                <Text style={styles.fonts}>擅 长</Text>
                <Text style={styles.context}>从事肺癌、消化道肿瘤、乳腺癌，
                    泌尿生殖系统肿瘤等常见实体瘤的内科治疗十余年，
                    对于肿瘤的化疗、靶向、内分泌治疗、免疫治疗等综合治疗具有丰富的临床经验，
                    对于少见、罕见肿瘤具有一定经验。擅长制定肿瘤的个体化治疗方案，
                    并关注患者的生活质量，肿瘤的舒缓治疗，营养支持等。</Text>
                <Text style={styles.fonts}>
                简介：
                </Text>
                <Text style={styles.context}>
                    {item.desc}
                </Text>
            </View>
          </ScrollView>
        </View>
      ))}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#FFFFFF",
  },
  top: {
    width: Dimensions.get("window").width,
    height: 100,
    flexDirection: "row",
  },
  main: {
    width: Dimensions.get("window").width,
  },
  fonts:{
    fontSize:20,
    fontWeight:"bold",
    marginTop:20
  },
  context:{
    marginTop:10,
    fontSize:15
  }
});
